.\" $Id: PAPI_enum_event.3,v 1.8.12.1 2006/11/02 21:24:31 terpstra Exp $
.TH PAPI_enum_event 3 "October, 2006" "PAPI Programmer's Reference" "PAPI"

.SH NAME
.nf
PAPI_enum_event \- enumerate PAPI preset or native events
.fi

.SH SYNOPSIS
.B C Interface
.nf
.B #include <papi.h>
.BI "int PAPI_enum_event(int " *EventCode, "int " modifer ");"
.fi
.B Fortran Interface
.nf
.B #include "fpapi.h"
.BI PAPIF_enum_event(C_INT\  EventCode,\  C_INT\  modifier ,\  C_INT\  check )
.fi

.SH DESCRIPTION
Given a preset or native event code,
.B "PAPI_enum_event()"
replaces the event code with the next available event in either the preset or native table. 
The 
.I modifier
argument affects which events are returned. For all platforms and event types, a value of 
.B PAPI_ENUM_ALL
(zero) directs the function to return all possible events. For preset events, a 
TRUE (non-zero) value currently directs the function to return event codes only for 
PAPI preset events available on this platform. This may change in the future. 
For native events, the effect of the
.I modifier 
argument is different on each platform. See the discussion below for  
platform-specific definitions.


.SH ARGUMENTS
.I EventCode
-- a defined preset or native event such as PAPI_TOT_INS.
.LP
.I modifier
-- modifies the search logic. For preset events, TRUE specifies available events only.
For native events, each platform behaves differently. 
See platform-specific documentation for details

.SH PENTIUM 4
The following values are implemented for 
.I modifier
on Pentium 4:
.B "  PAPI_PENT4_ENUM_GROUPS"
- 45 groups + custom + user event types
.B "  PAPI_PENT4_ENUM_COMBOS"
- all combinations of mask bits for given group
.B "  PAPI_PENT4_ENUM_BITS  "
- all individual bits for a given group

.SH ITANIUM
The following values are implemented for 
.I modifier
on Itanium:
.B "  PAPI_ITA_ENUM_IARR"
- Enumerate IAR (instruction address ranging) events
.B "  PAPI_ITA_ENUM_DARR"
- Enumerate DAR (data address ranging) events
.B "  PAPI_ITA_ENUM_OPCM"
- Enumerate OPC (opcode matching) events
.B "  PAPI_ITA_ENUM_IEAR"
- Enumerate IEAR (instr event address register) events
.B "  PAPI_ITA_ENUM_DEAR"
- Enumerate DEAR (data event address register) events

.SH POWER 4
The following values are implemented for 
.I modifier
on POWER 4:
.B "  PAPI_PWR4_ENUM_GROUPS"
- Enumerate groups to which an event belongs

.SH RETURN VALUES
On success, this function returns
.B "PAPI_OK" ,
and on error, a non-zero error code is returned.

.SH ERRORS
.TP
.B "PAPI_ENOEVNT"
The next requested PAPI preset or native event is not available on the underlying hardware. 

.SH EXAMPLES
.nf
.if t .ft CW
/* Scan for all supported native events on this platform */

   printf("Name\t\t\t       Code\t   Description\n");
   do {
         retval = PAPI_get_event_info(i, &info);
         if (retval == PAPI_OK) {
            printf("%-30s 0x%-10x\n%s\n", info.symbol, info.event_code, info.long_descr);
         }
   } while (PAPI_enum_event(&i, PAPI_ENUM_ALL) == PAPI_OK);

.if t .ft P
.fi

.SH BUGS
This function has no known bugs.

.SH SEE ALSO
.BR PAPI_preset "(3), " PAPI_native "(3), "
.BR PAPI_get_event_info "(3), " PAPI_event_name_to_code "(3)" 
.BR PAPI "(3), " PAPIF "(3)"
